home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
EARCD
/
comm
/
tcp
/
rxfingerd.lha
/
rx.fingerd
Wrap
Text File
|
1996-11-10
|
2KB
|
62 lines
/*
* Arexx Finger Daemon With Connection Logging
* -------------------------------------------
*
* - Make sure this script has the S bit set and copy it to
* "AmiTCP:serv/rx.fingerd"
* - Change the entry for finger in AmiTCP:db/inetd.conf to:
* "finger stream tcp dos bin - rx AmiTCP:serv/rx.fingerd"
*
* This script is based in part on a more basic script that I found
* last year - original author unknown. I have modified it to work
* correctly with both finger client and telnet connections, and made
* several other small alterations.
*
* Philip Stokes <phil@stokes.demon.co.uk> 08/11/96
*/
CR = '0d'x
log = "UULib:fingerlog" /* Path to logfile */
options results
address AMITCP 'QUERY CONNECTIONS';info = result
do conn = 1 to 10
hexad = word(info, conn*8-2)
port = x2d(word(info, conn*8-3))
state = word(info, conn*8)
if (port = 79 & hexad ~= 0 & state = 4) then do
address = x2d(substr(hexad, 1, 2)) || "." || x2d(substr(hexad, 3, 2))
address = address || "." || x2d(substr(hexad, 5, 2)) || "."
address = address || x2d(substr(hexad, 7, 2))
open(rslv, 'APIPE:AmiTCP:bin/resolve ' address, R)
address = word(readln(rslv), 3);close(rslv)
tolog = date(E) " " time() " " address
if ~exists(log) then do
call open(lg, log, W);writeln(lg, tolog)
end
else do
open(lg, log, A);writeln(lg, tolog)
end
end
end
call writeln(stdout,'Hello '||address||': Your connection is being logged.')
arg = compress(readln(stdin),CR)
arg = compress(arg,'`')
select
when index(arg,'@') =1 then do
parse var arg '@' host
user = host
end
when index(arg,'@') >1 then do
parse var arg user '@' host
end
otherwise user = arg
end
if user = '' then do
address COMMAND 'AmiTCP:bin/finger'
end
else do
address COMMAND 'AmiTCP:bin/finger' user
end
exit